package xyz.eden.gateway.springcloud.admin.util;

import org.springframework.http.HttpMethod;

import java.util.Objects;

public class HttpMethodUtil {


    public static String builderMethod(HttpMethod method) {
        if (Objects.isNull(method)) {
            return "";
        }

        String methodKey;
        switch (method) {
            case GET: {
                methodKey = "get";
                break;
            }
            case POST: {
                methodKey = "post";
                break;
            }
            case PUT: {
                methodKey = "put";
                break;
            }
            case DELETE: {
                methodKey = "delete";
                break;
            }
            case OPTIONS: {
                methodKey = "options";
                break;
            }
            default: {
                methodKey = "";
            }

        }
        return methodKey;
    }
}
